package com.fesine.quartz.chapter14;

import java.io.Serializable;

/**
 * @description: 类描述
 * @author: Fesine
 * @createTime:2016/11/20 19:45
 * @update:修改内容
 * @author: Fesine
 * @updateTime:2016/11/20 19:45
 */
public class JobResult implements Serializable {
    private static final long serialVersionUID = -9104725611992996295L;
    private boolean success;
    private String jobName;
    private long startedTime;
    private long finishedTime;

    public JobResult() {
        startedTime = System.currentTimeMillis();
    }

    // getters and setters not shown in this listing

    public String toString() {
        StringBuffer buf = new StringBuffer();
        buf.append(jobName);
        buf.append(" executed in ");
        buf.append(finishedTime - startedTime);
        buf.append(" (msecs) ");

        if (success) {
            buf.append("and was successful. ");
        } else {
            buf.append("but was NOT successful. ");
        }

        return buf.toString();
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getJobName() {
        return jobName;
    }

    public void setJobName(String jobName) {
        this.jobName = jobName;
    }

    public long getStartedTime() {
        return startedTime;
    }

    public void setStartedTime(long startedTime) {
        this.startedTime = startedTime;
    }

    public long getFinishedTime() {
        return finishedTime;
    }

    public void setFinishedTime(long finishedTime) {
        this.finishedTime = finishedTime;
    }
}
